@first-ch/tools-mcp 0.30.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/html-md.mjs +1226 -0
- package/package.json +9 -3
- package/server.mjs +50 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @first-ch/tools-mcp
|
|
2
2
|
|
|
3
|
-
MCP server exposing [First CH Tools](https://tools.first-ch.com)' free web-tool logic — WCAG contrast, JP character/X-weight counting, WebP conversion, JSON-LD generation, llms.txt generation, encoding/line-ending conversion, Marp Markdown→slide rendering, Japanese/English test-data generation, text/code diffing, cron-expression explanation, Base64/data-URI encoding, URL query-parameter editing, HTML entity escaping/unescaping, JSON⇄YAML conversion, px ⇄ rem/em unit conversion, colour-code conversion with alpha compositing, MD5/SHA-1/SHA-256/SHA-384/SHA-512 hashing, JWT decoding with expiry and signature checks, User-Agent parsing with device/bot detection, bulk UUID v4 / ULID generation, aspect-ratio calculation with responsive sizing, case conversion between camelCase, snake_case and kebab-case, CSV/TSV ⇄ JSON conversion, IP/CIDR calculation with subnet splitting and IP-range reduction,
|
|
3
|
+
MCP server exposing [First CH Tools](https://tools.first-ch.com)' free web-tool logic — WCAG contrast, JP character/X-weight counting, WebP conversion, JSON-LD generation, llms.txt generation, encoding/line-ending conversion, Marp Markdown→slide rendering, Japanese/English test-data generation, text/code diffing, cron-expression explanation, Base64/data-URI encoding, URL query-parameter editing, HTML entity escaping/unescaping, JSON⇄YAML conversion, px ⇄ rem/em unit conversion, colour-code conversion with alpha compositing, MD5/SHA-1/SHA-256/SHA-384/SHA-512 hashing, JWT decoding with expiry and signature checks, User-Agent parsing with device/bot detection, bulk UUID v4 / ULID generation, aspect-ratio calculation with responsive sizing, case conversion between camelCase, snake_case and kebab-case, CSV/TSV ⇄ JSON conversion, IP/CIDR calculation with subnet splitting and IP-range reduction, business-day date calculation with Japanese public holidays, and HTML-to-Markdown conversion — to AI agents such as Claude Code.
|
|
4
4
|
|
|
5
5
|
日本語版は [後半セクション](#日本語) を参照してください。
|
|
6
6
|
|
|
@@ -78,6 +78,8 @@ This server is also registered in the [MCP Registry](https://registry.modelconte
|
|
|
78
78
|
|
|
79
79
|
| `date_calc` | Counts the days and business days between two dates, works out the due date N days or N business days from a start date, and turns a closing day plus payment terms into a payment date — the same logic as the browser tool at tools.first-ch.com/date-calc/. For delivery dates, acceptance deadlines and payment schedules. **A business day is any day that is not a weekend, a Japanese public holiday or a closure you list**; the holiday table shipped with the package is the one published by Japan's Cabinet Office (1970–2027), so the "Happy Monday" holidays that move each year, substitute holidays after a Sunday holiday, citizens' holidays squeezed between two holidays (2026-09-22) and the shifting equinox days are all counted. `mode="between"` returns calendar days, business days, the breakdown of days off and every holiday in the range. `mode="add"` moves `n` (negative counts backwards) units from `base` and also lists the days it skipped; **"within 10 business days of receipt" differs by one depending on whether day zero counts**, so counting starts the day after by default (the Japanese civil-code rule) and `include_start=true` makes the start date day 1. `mode="payment"` resolves `invoice` + `closing` + `pay_months` + `pay_day`, moving a payment that lands on a day off by `pay_adjust` (default `prev`, the usual Japanese practice). The weekend, the New Year break, your own closures and your working weekends can all be set. Dates are held as days since 1970-01-01, so the server's time zone cannot shift the answer | `mode?` (`between` / `add` / `payment`), `start?`, `end?`, `base?`, `n?`, `unit?` (`business` default / `days` / `weeks` / `months` / `years`), `include_start?`, `adjust?`, `invoice?`, `closing?` (`eom` default / 1-31 / `none`), `pay_months?`, `pay_day?`, `pay_adjust?`, `weekend?`, `holidays?`, `year_end?`, `closed_dates?`, `work_dates?`, `lang?` |
|
|
80
80
|
|
|
81
|
+
| `html_to_markdown` | Converts an HTML fragment into Markdown — the same logic as the browser tool at tools.first-ch.com/html-md/. For turning a fetched page into something an LLM can read cheaply, and for moving existing web copy into Markdown. Headings (h1-h6), paragraphs, line breaks, emphasis, strikethrough, lists (nested, the `start` attribute, checkboxes), tables (thead / caption, with column alignment taken from `align` and `text-align`), links, images, code blocks (the language comes from `class="language-*"`), block quotes, horizontal rules, definition lists, figure / figcaption and details / summary are all handled, while `script`, `style`, anything marked `hidden` or `display:none` and presentational `div` / `span` wrappers are removed. **The HTML is not parsed with the browser DOM**: the tokeniser and tree builder are written by hand, so this server and the web page agree exactly, and unclosed elements are closed at the end while stray closing tags are dropped — the counts always come back in `notes`. **An attribute quote that is never closed stops the tag there**, because carrying on would swallow the rest of the document as one attribute value. **Whatever Markdown cannot express is reported rather than dropped in silence**: merged cells (a `colspan` is padded with empty cells, a `rowspan` keeps its value on the first row only), a cell holding a list or a code block (that table is left as HTML), definition lists (written in the Markdown Extra `: ` form) and `sup` / `sub` / `mark` / `iframe` / `svg` (`unknown` chooses between keeping them as HTML, reducing them to text and removing them). Tables, task lists and strikethrough are GFM extensions, so `gfm=false` switches them off. `base_url` rewrites relative links and images as absolute URLs — the thing that breaks most often in a migration — and `main_only` keeps only `main` / `article`, dropping `header`, `nav`, `footer`, `aside` and `form`. It never touches the network; fetching the page is the caller's job | `html?` or `path?`, `outputPath?`, `main_only?`, `base_url?`, `gfm?`, `escape?`, `pad_tables?`, `headings?` (`atx` default / `setext`), `bullet?` (`-` / `*` / `+`), `code_block?` (`fenced` / `indented`), `links?` (`inline` / `reference` / `strip`), `images?` (`keep` / `alt` / `drop`), `tables?` (`gfm` / `html`), `unknown?` (`keep` / `text` / `drop`), `br?` (`spaces` / `backslash` / `html` / `space`), `lang?` (`ja` default / `en`) |
|
|
82
|
+
|
|
81
83
|
See [`server.mjs`](./server.mjs) for the exact Zod input schemas.
|
|
82
84
|
|
|
83
85
|
**PDF output (`marp_render`) needs a local Chrome/Chromium.** marp-core renders the HTML with no browser dependency (so the package stays light for `npx`); PDF is produced by driving a locally-installed Chrome/Chromium in headless mode. It is auto-detected on common paths, or set `MARP_CHROME_PATH` to the executable. If none is found, `marp_render` returns the HTML only and reports `pdf_skipped` — you can still open that HTML and print → PDF yourself (one slide per page).
|
|
@@ -121,7 +123,7 @@ Release rule: a push to `main` automatically publishes a new package version thr
|
|
|
121
123
|
|
|
122
124
|
## 日本語
|
|
123
125
|
|
|
124
|
-
`@first-ch/tools-mcp` は、[First CH Tools](https://tools.first-ch.com)(無料Webツール集)の計算ロジック — WCAGコントラスト比・日本語文字数/Xウェイト計測・WebP変換・JSON-LD生成・llms.txt生成・文字コード/改行コード変換・Marp Markdown→スライド レンダリング・テストデータ生成・テキスト/コード差分・Cron式の解説・Base64/Data URI変換・URLパラメータの分解/編集/再構築・HTML特殊文字のエスケープ/エンティティのデコード・JSON⇄YAMLの相互変換・px⇄rem/emの単位換算とCSSの一括変換・カラーコードの相互変換とアルファ透過の合成・MD5/SHA-1/SHA-256/SHA-384/SHA-512のハッシュ生成と照合・JWTのデコードと有効期限/署名の検証・User-Agent文字列の解析とデバイス判定・UUID v4 / ULIDの一括生成・アスペクト比の計算とレスポンシブサイズの算出・camelCase / snake_case / kebab-case などの文字列ケース変換・CSV/TSV ⇄ JSON
|
|
126
|
+
`@first-ch/tools-mcp` は、[First CH Tools](https://tools.first-ch.com)(無料Webツール集)の計算ロジック — WCAGコントラスト比・日本語文字数/Xウェイト計測・WebP変換・JSON-LD生成・llms.txt生成・文字コード/改行コード変換・Marp Markdown→スライド レンダリング・テストデータ生成・テキスト/コード差分・Cron式の解説・Base64/Data URI変換・URLパラメータの分解/編集/再構築・HTML特殊文字のエスケープ/エンティティのデコード・JSON⇄YAMLの相互変換・px⇄rem/emの単位換算とCSSの一括変換・カラーコードの相互変換とアルファ透過の合成・MD5/SHA-1/SHA-256/SHA-384/SHA-512のハッシュ生成と照合・JWTのデコードと有効期限/署名の検証・User-Agent文字列の解析とデバイス判定・UUID v4 / ULIDの一括生成・アスペクト比の計算とレスポンシブサイズの算出・camelCase / snake_case / kebab-case などの文字列ケース変換・CSV/TSV ⇄ JSON の相互変換・日数/営業日の計算(日本の祝日を内蔵)・HTML→Markdownの変換 — をAIエージェント(Claude Code等)向けMCPツールとして提供するサーバーです。
|
|
125
127
|
|
|
126
128
|
### インストール
|
|
127
129
|
|
|
@@ -197,6 +199,8 @@ claude mcp add firstch-tools -- npx -y @first-ch/tools-mcp
|
|
|
197
199
|
|
|
198
200
|
| `date_calc` | 2つの日付の間の日数・営業日数、起点日から N日後/N営業日後の期日、締め日と支払サイトからの支払日を計算する。tools.first-ch.com/date-calc/ と同一ロジック。納期・検収期限・支払サイトの確認のための道具。**営業日は「土日・日本の祝日・指定した休業日を除いた日」**で、祝日は内閣府「国民の祝日について」の一覧をパッケージに同梱している(1970年〜2027年)ため、ハッピーマンデーで動く祝日・日曜と重なったときの振替休日・前後を祝日に挟まれた国民の休日(2026-09-22)・年によって変わる春分の日/秋分の日がすべて計算に入る。`mode="between"` は暦日数・営業日数・休みの内訳・期間内の祝日一覧を返す。`mode="add"` は `base` から `n`(負なら過去へ)を `unit` の単位で進めた期日と、飛ばした休みの一覧を返す。**「受領後10営業日」は初日を数えるかで1日ずれる**ので、民法の原則どおり翌日起算を既定とし、`include_start=true` で起点日を1日目として数える。`mode="payment"` は `invoice`・`closing`・`pay_months`・`pay_day` から支払日を求め、休みに当たったら `pay_adjust`(既定 `prev`=前営業日へ繰り上げ・日本の商慣習)で寄せる。週の休み・年末年始・自社の休業日・休日出勤も指定できる。日付は「1970-01-01からの通算日」の整数で扱うのでサーバーのタイムゾーンで1日ずれない | `mode?`(`between` / `add` / `payment`)、`start?`、`end?`、`base?`、`n?`、`unit?`(既定 `business` / `days` / `weeks` / `months` / `years`)、`include_start?`、`adjust?`、`invoice?`、`closing?`(既定 `eom` / 1〜31 / `none`)、`pay_months?`、`pay_day?`、`pay_adjust?`、`weekend?`、`holidays?`、`year_end?`、`closed_dates?`、`work_dates?`、`lang?` |
|
|
199
201
|
|
|
202
|
+
| `html_to_markdown` | HTML断片をMarkdownへ変換する。tools.first-ch.com/html-md/ と同一ロジック。取得したページの本文をLLMへ渡す前の後処理、既存サイトの原稿をMarkdown管理へ移す移行作業のための道具。見出し(h1〜h6)・段落・改行・強調・取り消し線・リスト(入れ子・`start` 属性・チェックボックス)・表(thead / caption と `align`・`text-align` による列の配置)・リンク・画像・コードブロック(`class="language-*"` から言語を拾う)・引用・水平線・定義リスト・figure / figcaption・details / summary に対応し、`script`・`style`・`hidden` や `display:none` の要素・装飾のための `div` / `span` は自動で取り除く。**HTMLの解釈にブラウザのDOMを使っていない**——字句解析も木の組み立ても自前なのでWeb版と結果が一致し、閉じ忘れたタグは末尾で閉じ、行き場のない閉じタグは捨てて変換を続ける(補った件数は必ず `notes` で返す)。**属性の引用符が閉じていない場合だけは打ち切る**——続けると残りの文書全体を1つの属性値として飲み込むため。**Markdownに書けないものは黙って捨てず報告する**: セルの結合(`colspan` は空セルで埋め、`rowspan` は先頭行にだけ値が入る)・セル内のリスト/コードブロック(その表だけHTMLのまま残す)・定義リスト(Markdown Extra の `: ` 記法)・`sup` / `sub` / `mark` / `iframe` / `svg`(`unknown` で「HTMLのまま残す/文字だけ残す/取り除く」を選ぶ)。表・タスクリスト・取り消し線はGFMの拡張なので `gfm=false` で切れる。`base_url` を渡すと相対URLのリンクと画像を絶対URLへ直し(移行でいちばん壊れるところ)、`main_only=true` は `main` / `article` の中だけを取り出して `header`・`nav`・`footer`・`aside`・`form` を落とす。ネットワークへは出ない(ページの取得は呼び出し側の仕事) | `html?` または `path?`、`outputPath?`、`main_only?`、`base_url?`、`gfm?`、`escape?`、`pad_tables?`、`headings?`(既定 `atx` / `setext`)、`bullet?`(`-` / `*` / `+`)、`code_block?`(`fenced` / `indented`)、`links?`(`inline` / `reference` / `strip`)、`images?`(`keep` / `alt` / `drop`)、`tables?`(`gfm` / `html`)、`unknown?`(`keep` / `text` / `drop`)、`br?`(`spaces` / `backslash` / `html` / `space`)、`lang?`(既定 `ja` / `en`) |
|
|
203
|
+
|
|
200
204
|
正確な入力スキーマ(Zod定義)は [`server.mjs`](./server.mjs) を参照してください。
|
|
201
205
|
|
|
202
206
|
**`marp_render` のPDF出力にはローカルの Chrome/Chromium が必要です。** marp-core によるHTML生成はブラウザ非依存(`npx` 導入を軽く保つため)で、PDFはローカルインストール済みの Chrome/Chromium を headless で駆動して生成します。定番パスから自動検出し、`MARP_CHROME_PATH` で実行ファイルを明示することもできます。見つからない場合は HTML のみを返し `pdf_skipped` を報告します(そのHTMLを開いて印刷→PDF保存でも1スライド=1ページで作成できます)。
|